<!DOCTYPE html>
<html lang="en">
<head>
  <title>浩然金融中心管理平台</title>
  <meta charset="utf-8">
  <meta content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0"
        name="viewport">
  <#include "/common/csslib.html">
</head>
<body>
<div class="main-wrapper">
  <!-- start: MAIN CONTAINER -->
  <div class="main-container inner">
    <!-- start: PAGE -->
    <div class="main-content">
      <div class="container">
        <div class="row h-home-path">
          <div class="col-md-12">
            <ol class="breadcrumb">
              <li><i class="fa fa-home"></i>&nbsp;&nbsp;所在位置</li>
              <li>首页</li>
              <li class="active">接口方法管理</li>
            </ol>
          </div>
        </div>
        <div class="row">
          <ul class="nav nav-tabs" id="myTab">
            <li class="active" id="tab-apiFacadeMethod"><a data-toggle="tab" href="#tab-apiFacadeMethodDiv">
              编辑接口方法信息</a></li>
            <#if apiFacadeMethod?? && apiFacadeMethod.publicRequestList?? &&
            (apiFacadeMethod.publicRequestList?size > 0)>
            <#list apiFacadeMethod.publicRequestList as publicRequest>
            <li id="tab-${publicRequest.objCode!}"><a data-toggle="tab" href="#tab-${publicRequest.objCode}Div">
              ${publicRequest.objName!}</a></li>
          </#list>
        </#if>
        <#if apiFacadeMethod?? && apiFacadeMethod.publicResponseList?? &&
        (apiFacadeMethod.publicResponseList?size > 0)>
          <#list apiFacadeMethod.publicResponseList as publicResponse>
          <li id="tab-${publicResponse.objCode!}"><a data-toggle="tab"
                                                     href="#tab-${publicResponse.objCode}Div">${publicResponse.objName!}</a>
          </li>
        </#list>
    </#if>
    <#if apiFacadeMethod?? && apiFacadeMethod.requestList?? &&
    (apiFacadeMethod.requestList?size > 0)>
        <#list apiFacadeMethod.requestList as request>
        <li id="tab-${request.objCode!}"><a data-toggle="tab" href="#tab-${request.objCode}Div">${request.objName!}</a>
        </li>
      </#list>
</#if>
<#if apiFacadeMethod?? && apiFacadeMethod.responseList?? &&
(apiFacadeMethod.responseList?size > 0)>
      <#list apiFacadeMethod.responseList as response>
      <li id="tab-${response.objCode!}"><a data-toggle="tab" href="#tab-${response.objCode}Div">${response.objName!}</a>
      </li>
    </#list>
</#if>
    </ul>
    <div class="tab-content" id="myTabContent">
      <div class="tab-pane fade in active" id="tab-apiFacadeMethodDiv">
        <#include "/api/apiFacadeMethod_form.html">
      </div>
      <#if apiFacadeMethod?? && apiFacadeMethod.publicRequestList?? &&
      (apiFacadeMethod.publicRequestList?size > 0)>
      <#list apiFacadeMethod.publicRequestList as publicRequest>
      <div class="tab-pane fade" id="tab-${publicRequest.objCode}Div">
        <form action="/apiFacadeObjParam/saveApiFacadeObjParam" class="form-horizontal" id="publicRequestForm"
              method="post" role="form">
          <div class="form-group" style="width:800px;">
            <table class="table-bordered table-hover text-center dataTable no-footer">
              <thead>
              <tr role="row">
                <td>编码</td>
                <td>描述</td>
                <td>最大长度</td>
                <td>类型</td>
                <td>是否必填</td>
                <td>示例值</td>
                <td>操作</td>
              </tr>
              </thead>
              <tbody>
              <#if apiFacadeMethod?? && apiFacadeMethod.apiFacadeObjParamList?? &&
              (apiFacadeMethod.apiFacadeObjParamList?size > 0)>
              <#list publicRequest.apiFacadeObjParamList as param>
              <tr>
                <td class="text-left">${param.paramCode}</td>
                <td class="text-left">${param.paramDesc}</td>
                <td class="text-left">${param.maxLength}</td>
                <td class="text-left">${param.paramJavaTypeCn}</td>
                <td class="text-left">${param.isRequiredCn}</td>
                <td class="text-left">${param.paramDemo}</td>
                <td>
                  <#if operation !='view'>
                  <a href="javascript:void(0);"
                     onclick="ApiFacadeObjMgr.updateParam('${publicRequest.id!}','${param.id!}')">修改</a>
                  <a href="javascript:void(0);"
                     onclick="ApiFacadeObjMgr.deleteParam('${publicRequest.id!}','${param.id!}')">删除</a>
                </#if>
                </td>
              </tr>
              </#list>
            </#if>
              </tbody>
            </table>
          </div>
        </form>
      </div>
    </#list>
   </#if>
<#if apiFacadeMethod?? && apiFacadeMethod.publicResponseList?? &&
(apiFacadeMethod.publicResponseList?size > 0)>
    <#list apiFacadeMethod.publicResponseList as publicResponse>
    <div class="tab-pane fade" id="tab-${publicResponse.objCode}Div">
      <form action="/apiFacadeObjParam/saveApiFacadeObjParam" class="form-horizontal" id="publicResponseForm"
            method="post" role="form">
        <div class="form-group" style="width:800px;">
          <table class="table-bordered table-hover text-center dataTable no-footer">
            <thead>
            <tr role="row">
              <td>编码</td>
              <td>描述</td>
              <td>最大长度</td>
              <td>类型</td>
              <td>是否必填</td>
              <td>示例值</td>
              <td>操作</td>
            </tr>
            </thead>
            <tbody>
            <#if apiFacadeMethod?? && apiFacadeMethod.apiFacadeObjParamList?? &&
            (apiFacadeMethod.apiFacadeObjParamList?size > 0)>
            <#list publicResponse.apiFacadeObjParamList as param>
            <tr>
              <td class="text-left">${param.paramCode!}</td>
              <td class="text-left">${param.paramDesc!}</td>
              <td class="text-left">${param.maxLength!}</td>
              <td class="text-left">${param.paramJavaTypeCn!}</td>
              <td class="text-left">${param.isRequiredCn!}</td>
              <td class="text-left">${param.paramDemo!}</td>
              <td>
                <#if operation !='view'>
                <a href="javascript:void(0);"
                   onclick="ApiFacadeObjMgr.updateParam('${publicResponse.id!}','${param.id!}')">修改
                </a>
                <a href="javascript:void(0);"
                   onclick="ApiFacadeObjMgr.deleteParam('${publicResponse.id!}','${param.id!}')">删除
                </a>
              </#if>
              </td>
            </tr>
            </#list>
            </#if>
            </tbody>
          </table>
        </div>
      </form>
    </div>
  </#list>
  </#if>
<#if apiFacadeMethod?? && apiFacadeMethod.requestList?? &&
(apiFacadeMethod.requestList?size > 0)>
  <#list apiFacadeMethod.requestList as request>
  <div class="form-group">
    <a href="javascript:void(0);" onclick="ApiFacadeObjMgr.addParam('${publicResponse.id!}')">新增</a>
  </div>
  <div class="tab-pane fade" id="tab-${request.objCode}Div">
    <form action="/apiFacadeObjParam/saveApiFacadeObjParam" class="form-horizontal" id="requestForm" method="post"
          role="form">
      <div class="form-group" style="width:800px;">
        <table class="table-bordered table-hover text-center dataTable no-footer">
          <thead>
          <tr role="row">
            <td>编码</td>
            <td>描述</td>
            <td>最大长度</td>
            <td>类型</td>
            <td>是否必填</td>
            <td>示例值</td>
            <td>操作</td>
          </tr>
          </thead>
          <tbody>
          <#if apiFacadeMethod?? && apiFacadeMethod.apiFacadeObjParamList?? &&
          (apiFacadeMethod.apiFacadeObjParamList?size > 0)>
          <#list request.apiFacadeObjParamList as param>
          <tr>
            <td class="text-left">${param.paramCode!}</td>
            <td class="text-left">${param.paramDesc!}</td>
            <td class="text-left">${param.maxLength!}</td>
            <td class="text-left">${param.paramJavaTypeCn!}</td>
            <td class="text-left">${param.isRequiredCn!}</td>
            <td class="text-left">${param.paramDemo!}</td>
            <td>
              <#if operation !='view'>
              <a href="javascript:void(0);"
                 onclick="ApiFacadeObjMgr.updateParam('${request.id!}','${param.id!}')">修改</a>
              <a href="javascript:void(0);"
                 onclick="ApiFacadeObjMgr.deleteParam('${request.id!}','${param.id!}')">删除</a>
            </#if>
            </td>
          </tr>
          </#list>
        </#if>
          </tbody>
        </table>
      </div>
    </form>
  </div>
</#list>
</#if>
<#if apiFacadeMethod?? && apiFacadeMethod.responseList?? &&
(apiFacadeMethod.responseList?size > 0)>
<#list apiFacadeMethod.responseList as response>
<div class="tab-pane fade" id="tab-${response.objCode}Div">
  <form action="/apiFacadeObjParam/saveApiFacadeObjParam" class="form-horizontal" id="apiFacadeObjParamForm"
        method="post"
        role="form">
    <div class="form-group" style="width:800px;">
      <table class="table-bordered table-hover text-center dataTable no-footer">
        <thead>
        <tr role="row">
          <td>编码</td>
          <td>描述</td>
          <td>最大长度</td>
          <td>类型</td>
          <td>是否必填</td>
          <td>示例值</td>
          <td>操作</td>
        </tr>
        </thead>
        <tbody>
        <#if apiFacadeMethod?? && apiFacadeMethod.apiFacadeParamList?? &&
        (apiFacadeMethod.apiFacadeParamList?size > 0)>
        <#list response.apiFacadeParamList as param>
        <tr>
          <td class="text-left">${param.paramCode!}</td>
          <td class="text-left">${param.paramDesc!}</td>
          <td class="text-left">${param.maxLength!}</td>
          <td class="text-left">${param.paramJavaTypeCn!}</td>
          <td class="text-left">${param.isRequiredCn!}</td>
          <td class="text-left">${param.paramDemo!}</td>
          <td>
            <#if operation !='view'>
            <a href="javascript:void(0);"
               onclick="ApiFacadeObjMgr.updateParam('${response.id!}','${param.id!}')">修改</a>
            <a href="javascript:void(0);"
               onclick="ApiFacadeObjMgr.deleteParam('${response.id!}','${param.id!}')">删除</a>
          </#if>
          </td>
        </tr>
        </#list>
      </#if>
        </tbody>
      </table>
    </div>
  </form>
</div>
</#list>
</#if>
</div>
</div>
</div>
</div>
<!-- end: PAGE -->
</div>
<!-- end: MAIN CONTAINER -->
</div>

<#include "/common/jslib.html">
<#include "/common/uploadlib.html">
<!-- 弹窗下拉 -->
<script type="text/javascript">
    function returnIndex() {
        window.location.href = "/apiFacadeMethod/query";
    }

    $(function () {
        (function () {
            $('.nav-tabs li').click(function () {
                $(this).addClass('active').siblings().removeClass('active');
                var _id = $(this).attr('id');
                $('.tab-content').find('#' + _id + "Div").addClass('active in').siblings().removeClass('active in');
            });
        })();
        // 页面操作类型：add(添加)-edit(编辑)-view(查看)
        var operation = $("#operation").val();
        // 弹出窗体控制
        ApiFacadeObjMgr = {
            // 初始化
            init: function () {
                // 查看的时候不显示保存按钮
                if (operation == "view") {
                    Jmts.setFormReadOnly();
                }
            },
            // init end

            // 提交数据
            submitForm: function () {
                Jmts.ajaxSubmit(document.getElementById("apiFacadeMethodForm"), function (result) {
                    if (result.success) {
                        if (operation == 'add') {
                            ApiFacadeObjMgr.returnIndex();
                        } else {
                            Jmts.succTips(result.msg);
                            window.location.reload();
                        }
                    } else {
                        Jmts.warnTips(result.msg);
                    }
                });
                return false;
            },
            // submitForm end
            returnIndex: function () {
                window.location.href = "/apiFacadeMethod/query";
            },
            updateParam: function (objId, objParamId) {

            },
            deleteParam: function (objId, objParamId) {
                var url = "/apiFacadeObjParam/delete";
                var data = {
                    "id": objParamId,
                    "objId": objId
                };
                Jmts.deleteItem("确认要删除吗？", url, data, function (result) {
                    if (result.success) {
                        Jmts.succTips("删除成功");
                        window.location.reload();
                    }
                });
            }
        };
        // 执行初始化
        ApiFacadeObjMgr.init();
        // 前台验证表单
        $("#apiFacadeMethodForm").validate();
    });
</script>
</body>
</html>
